/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package demo903;

/**
 *
 * @author Administrator
 */
import demo902.*;
import java.util.*;

public class StringDemo {

    public static void main(String[] args) {
        String names1 = "张三,李四,王五,张六";
        //String ns1[]=names1.split(",");
        String ns1[]={"张三","李四","王五","张六"};
        
        
        
        String names = "张三李四王五张六";
        
        char c=names.charAt(0);//'张'

        int m = 0, n = 0, k = 0;
        char name;
        for (int i = 0; i < names.length(); i++) {
            name = names.charAt(i);
            // if(names.substring(i,i+1).equals("张"))
            if (name=='张') {
                m++;
            } else if (name=='李') {
                n++;
            } else if (name=='王') {
                k++;
            }

        }
        System.out.println(m);
        System.out.println(n);
        System.out.println(k);

    }
}

